<template>
	<view class="m-2">
		<!-- indicator-dots 是否显示面板指示点 autoplay 自动切换 circular 是否采用衔接滑动，即播放到末尾后重新回到开头 indicator-active-color 当前选中的指示点颜色 -->
		<swiper indicator-dots autoplay circular indicator-active-color="#ffffff" style="height: 380rpx;"
			@change="getCurrentImgIndex">
			<swiper-item v-for="(item, index) in imgArr" :key="index">
				<image :src="item.src" mode="aspectFill" class="w-100 animated"
					:class="currentImgIndex == index?'my-animate':''"></image>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentImgIndex: 0
			}
		},
		props: {
			imgArr: {
				type: Array,
				default: () => {}
			}
		},
		methods: {
			getCurrentImgIndex(e) {
				this.currentImgIndex = e.detail.current
			}
		}
	}
</script>

<style>
</style>
